package com.kingwang.training.designpattern.mediator;

import com.kingwang.training.designpattern.mediator.bo.Iran;
import com.kingwang.training.designpattern.mediator.bo.USA;
import com.kingwang.training.designpattern.mediator.bo.UnitedNationSecurityCouncil;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MediatorApplication implements ApplicationRunner {

    public static void main(String[] args) {
        SpringApplication.run(MediatorApplication.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        UnitedNationSecurityCouncil unsc = new UnitedNationSecurityCouncil();

        USA usa = new USA(unsc);
        Iran iran = new Iran(unsc);

        // 双边会谈
        unsc.setColleague1(usa);
        unsc.setColleague2(iran);

        usa.declare("不准研制核武器，否则要发动制裁");
        iran.declare("我们没有核武器，也不怕侵略者");
    }
}
